const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
    //入口文件
    mode:"production",
    entry: path.join(__dirname, './src/main.js'),
    //出口文件
    output:{
        path:path.resolve(__dirname,'./dist'),
        filename:'index.js'
    },
    plugins:[
        new HtmlWebpackPlugin({
            title: '首页',  //生成的页面标题<head><title>首页</title></head>
            filename: 'main.html', // dist目录下生成的文件名
            template: './src/main.html' // 我们原来的index.html，作为模板
        })
    ],
    devServer: {
      port: 9000,
      open: true,
      contentBase: path.resolve(__dirname, './dist')
    }
};